package com.smart.base.tools.generator.pojo.model;

import java.util.List;

import com.smart.base.tools.generator.pojo.GenerateMain;


/**
 * @ClassName：TableMeta
 * @Description：表结构信息
 * @author：shisongbin
 * @date：2016年5月24日 下午4:45:06
 */
public class TableMeta {
	private String schemaName;

	private String tableName;

	private String comment;

	private String packageDir;

	private String primaryKey;

	private String author;

	private List<ColumnMeta> columns;

	public String getTableName() {
		return tableName.toLowerCase();
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public List<ColumnMeta> getColumns() {
		return columns;
	}

	public void setColumns(List<ColumnMeta> columns) {
		this.columns = columns;
	}

	public String getClassName() {
		if (tableName == null) {
			return "";
		}
		StringBuffer className = new StringBuffer();
		String newName = tableName.substring(GenerateMain.TABLE_PREFIX.length());
		String[] names = newName.toLowerCase().split("_");
		for (int i = 0, len = names.length; i < len; i++) {
			className.append(names[i].substring(0, 1).toUpperCase() + names[i].substring(1));
		}
		return className.toString();
	}

	public String getSchemaName() {
		return schemaName;
	}

	public void setSchemaName(String schemaName) {
		this.schemaName = schemaName;
	}

	/**
	 * @return the packageDir
	 */
	public String getPackageDir() {
		return packageDir;
	}

	/**
	 * @param packageDir
	 *            the packageDir to set
	 */
	public void setPackageDir(String packageDir) {
		this.packageDir = packageDir;
	}

	/**
	 * @return the primaryKey
	 */
	public String getPrimaryKey() {
		return primaryKey;
	}

	/**
	 * @param primaryKey
	 *            the primaryKey to set
	 */
	public void setPrimaryKey(String primaryKey) {
		this.primaryKey = primaryKey;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}
}
